package com.example.admin.myapplication;

import android.app.Activity;
import android.os.Bundle;

import tv.ismar.player.SmartPlayer;

public class MainActivity extends Activity {

    private IsmatvVideoView video;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        video = (IsmatvVideoView) findViewById(R.id.video);
        video.setVideoPath("http://sky.tvxio.bestv.com.cn/v4_0/SKY2/touc/api/live/m3u8/6/47a9a0da-3736-47c4-9d16-eee9c8143b2e/medium/");
        video.setOnPreparedListenerUrl(new SmartPlayer.OnPreparedListenerUrl() {
            @Override
            public void onPrepared(SmartPlayer smartPlayer, String s) {
                if(video.isPlaying()){
                    video.stopPlayback();
                }
                video.start();
            }
        });
    }

    @Override
    protected void onDestroy() {
        video=null;
        super.onDestroy();
    }
}
